package shop.entity;

import lombok.Data;

@Data
public class ResponseMessage<T> {
    private int code;
    private String message;
    private T data;

    public ResponseMessage(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static <T> ResponseMessage<T> success(T data) {
        ResponseMessage<T> response = new ResponseMessage<>(200, "success", data);
        return response;
    }
    public static <T> ResponseMessage<T> error(int code, String message) {
        ResponseMessage<T> response = new ResponseMessage<>(code, message, null);
        return response;
    }
}
